Skip to content

fix(font): shape_fallback 增加 fallback chain 遍历——修复 C3 搜索框中文豆腐块 - #144

Merged
leizongmin merged 1 commit into
mainfrom
bing-t5-paint-bg-image
Oct 12, 2026
Merged

leizongmin merged 1 commit into
mainfrom
bing-t5-paint-bg-image

Conversation

@leizongmin

@leizongmin leizongmin commented Oct 12, 2026 •

Copy link
Copy Markdown
Owner

Note

Low Risk
Narrow change to the fontdue shaping fallback path; improves glyph resolution without touching auth, layout, or network code.

Overview
Fixes CJK “tofu” (.notdef / glyph_id=0) in the fontdue per-character fallback path when the primary face lacks a glyph—e.g. Chinese in the C3 search box.

When shape_fallback runs (after rustybuzz is unavailable), a missing glyph on the default font no longer immediately uses placeholder metrics. It walks FontLoader::fallback_chain() (CJK faces injected via set_fallback_chain in system.rs) and uses the first fallback font that has real glyph metrics; only if none match does it keep (0, font_size * 0.6).

Reviewed by Cursor Bugbot for commit 7ae4e71. Bugbot is set up for automated code reviews on this repo. Configure here.

shape_fallback 在主字体缺字形时直接用 glyph_id=0(.notdef = 豆腐块),
不尝试 fallback_chain 中的其他字体。修正:主字体查不到 glyph 时依次
尝试 fallback_chain 中的每个字体(NotoSansCJK/WQY 等已加载的 CJK 字体),
仅在全部字体都无该字形时才回退 .notdef。

FontLoader 已有 set_fallback_chain/fallback_chain() 基础设施(system.rs
加载 CJK 字体后注入),但 shape_fallback 未消费。本修复连接两者。

验证:render-foundation lib 706P/0F。
@cursor

cursor Bot commented Oct 12, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: 35368088-ef1c-46d5-87f8-fa8c8ede6706)

@leizongmin
leizongmin merged commit 247ad10 into main Oct 12, 2026
2 checks passed
leizongmin added a commit that referenced this pull request Oct 12, 2026
…hub(imported-tests.txt 双保留)

同步 main(#140–#144:R5073–R5079 layout/css 修复、webmessaging M2/M3、CORS range
safelist、shape_fallback 中文字体 fallback chain)。冲突仅 tests/wpt-runner/
imported-tests.txt:双方新增条目均保留(main 4 条 + 本分支
css-fonts/system-ui-bold-zw-001 1 条),无产品代码手工改动。

Co-Authored-By: Claude Code <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant